package com.dayuanit.mallenum;

import com.dayuanit.exception.MallException;

public enum AddressDefaultEnum {
	
	ADD_NON_DEFAULT(0), ADD_DEFAULT(1);
	
	private int flag;
	
	private AddressDefaultEnum(int flag) {
		this.flag = flag;
	}
	
	public int getFlag() {
		return this.flag;
	}
	
	public static AddressDefaultEnum getAddDefault(int flag) {
		
		for (AddressDefaultEnum ade : AddressDefaultEnum.values()) {
			if (flag == ade.getFlag()) {
				return ade;
			}
		}
		throw new MallException("地址默认值错误");
	}

}
